# -*- coding: utf-8 -*-
'''
Created on 2018年6月16日
@author: liaolzl
'''
#1.response响应类型
import urllib.request
response = urllib.request.urlopen('http://www.python.org')
print(type(response))

#2.response的状态码、响应头
import urllib.request
response = urllib.request.urlopen('http://www.python.org')
print(response.status) #打印url的响应码，返回200为成功相应
print(response.getheaders()) #打印url的响应头，返回是list形式
print(response.getheader('Server')) 

#3.response的响应体
import urllib.request
response = urllib.request.urlopen('http://www.python.org')
print(response.read().decode('utf-8'))